using System.Diagnostics;
using System.Windows.Input;
using ReplicationExplorer.Presentation.Commands;
using ReplicationExplorer.Presentation.Infrastructure;

namespace ReplicationExplorer.Presentation.ViewModel
{
    public class AboutViewModel : ViewModelBase
    {
        private readonly string _destinationUrl;
        private ICommand _openBrowserCommand;

        public AboutViewModel(string destinationUrl)
        {
            _destinationUrl = destinationUrl;
        }

        /// <summary>
        /// Returns a command that opens browser.
        /// </summary>
        public ICommand OpenBrowserCommand
        {
            get
            {
                if (_openBrowserCommand == null)
                {
                    _openBrowserCommand = new RelayCommand(param=>Process.Start(new ProcessStartInfo(DestinationUrl)));
                }

                return _openBrowserCommand;
            }
        }



        public string DestinationUrl
        {
            get { return _destinationUrl; }
        }
    }
}